package com.itheima.io.home.homework7;

import java.io.*;

/*
    请使用缓冲流将D盘下的某个音频或者视频文件，拷贝到当前模块目录下，
    并计算拷贝过程消耗的时间，将时间（单位毫秒）打印到控制台。
 */
public class Demo7 {
    public static void main(String[] args) throws IOException {
        BufferedInputStream bis=new BufferedInputStream(new FileInputStream("E:\\itcast\\view.mp4"));
        BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream("day12_io\\view.mp4"));
        byte[] arr=new byte[1024];
        int len;
        long time1 = System.currentTimeMillis();
        while((len=bis.read(arr))!=-1){
            bos.write(arr,0,len);

        }
        long time2 = System.currentTimeMillis();
        System.out.println(time2-time1);
        bis.close();
        bos.close();

    }
}
